<?php
$player = $game->player_get_uinfo();
$npc = $game->npc_get_info($arr_data->nid);
$任务状态图 = '';
$链接_任务列表 = "";
if ($npc->taskid!=''){
    $taskarr = explode(',',$npc->taskid);
    $taskhtml = '';
    for ($i=0;$i<count($taskarr);$i++){
        $task_player = $game->rw_player_get_info($taskarr[$i]); //是否有任务
        $task = $game->rw_get_sys($taskarr[$i]);
        $任务状态 = '';

        if ($task_player){

            if($task_player->rwzt == 2){
                $reztarr = array('普通', '日常','主线');
                $任务状态文本 = $reztarr[ $task->rwlx - 1];
                $任务状态图 = '<img src="./images/tan.gif" />';
                $任务状态 = "{$任务状态图}[{$任务状态文本}]";
            }

        }else{
            if ($task->chufa != $arr_data->nid){
                continue;
            }

            if ($task->lastrwid != -1){
                $lastrw = $game->rw_player_get_info($task->lastrwid);
                if (!$lastrw){
                    continue;
                }elseif ($lastrw->rwzt !=3){
                    continue;
                }
            }

            $reztarr = array('普通', '日常','主线');
            $任务状态文本 = $reztarr[ $task->rwlx - 1];
            $任务状态 = '<img src="./images/wen.gif" />';
            $任务状态 = "{$任务状态}[{$任务状态文本}]";
        }

        if ($任务状态){
            $rwcmd = $game->create_url("cmd=task&nid={$arr_data->nid}&rwid={$taskarr[$i]}","{$task->rwname}");
            $链接_任务列表 .="$任务状态{$rwcmd}<br/>";
        }

    }
}

$gnhtml='';
if ($npc->muban != ''){
    $mubanitem =  explode(',',$npc->muban);
    foreach ($mubanitem as $muban){
        $muban = iconv('UTF-8','GBK',$muban);
        if (file_exists("./game/muban/$muban")){
            include "./game/muban/$muban";
        }
    }
}
$image = "";
if (file_exists("./game/images/npc/{$arr_data->nid}.jpg")){
    $image = "<img src='./game/images/npc/{$nid}.jpg' width='200' height='300'><br/>";
}

$变量_npc =(object)[
    "NPC昵称"=>$npc->nname,
    "NPC性别"=>$npc->nsex,
    "NPC信息"=>$npc->ninfo,
    "NPC图片"=>$image,
    "链接_任务列表"=>$链接_任务列表,
    "NPC模板"=>$gnhtml
];


$dis_npc = $game->dis_get('排版_NPC');
eval("\$out_html = \"$dis_npc->dis_string\";");
$out_html = str_replace("<br/><br/>", "<br/>",$out_html);
$out_html = str_replace("<br/><br/>", "<br/>",$out_html);
$out_html = str_replace("</div><br/>", "</div>",$out_html);
echo $out_html;
?>
